<template>
  <formPage ref="ruleFormRef" :formList="formData" validCatch="基本信息有未填写的数据！" identifying="tab1" />
</template>
<script setup>
import { events } from "@/plugins/eventBus";

const props = defineProps({
  formList: {
    type: Array,
    default: [],
  },
});
const formData = computed(() => {
  return props.formList
    .filter((item) => {
      return item.is_base == 1;
    })
    .map((ele) => {
      let obj = {
        label: ele.name,
        prop: ele.field,
        formType: ele.form_type,
        required: ele.is_null == 1 ? true : false,
        rulesMessage: ele.input_tips || ele.name,
        placeholder: ele.input_tips || ele.name,
        termList: ele.termList,
      };
      if (ele.default_value) {
        obj.default_value = ele.default_value;
      }
      return obj;
    });
});

let ruleFormRef = ref(null);
function updateFun(row) {
  ruleFormRef.value.updateFun(row);
}
function initFun() {
  ruleFormRef.value.initFun();
}
defineExpose({
  updateFun,
  initFun,
});
onMounted(() => { });
</script>
<style scoped lang="scss">
.ruleform-tab {
  :deep(.el-form-item) {
    width: 100%;
    margin-right: 0;
    padding-right: 10px;
    box-sizing: border-box;

    .el-input {
      width: 100%;
    }
  }
}
</style>
